﻿using mds.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace mds.SqoopService
{
    internal class SqoopConfigure 
    {
        private static Dictionary<string, string> _sqoopHostCollections = new Dictionary<string, string>();
        private static Dictionary<string, int> _sqoopHostPortCollections = new Dictionary<string, int>();
        private static SqoopConfigure _instance = new SqoopConfigure();
        private SqoopConfigure()
        {
            Init();
        }
        public static SqoopConfigure Instance
        {
            get { return _instance; }
        }
        private void Init()
        {
            var config = ConfigurationAdapter.Instance.GetConfigItem<SqoopHostConfigItem>("SqoopService");
           
        }
      
        public string GetHostServer(string hostServerName)
        {
            if (_sqoopHostCollections.ContainsKey(hostServerName))
            {
                return _sqoopHostCollections[hostServerName];
            }
            return string.Empty;
        }
        public int GetHostPort(string hostServerName)
        {
            if (_sqoopHostPortCollections.ContainsKey(hostServerName))
            {
                return _sqoopHostPortCollections[hostServerName];
            }
            return -1;
        }
        public string GetDefaultHost()
        {
            return _sqoopHostCollections["default"];
        }
        public int GetDefaultPort()
        {
            return _sqoopHostPortCollections["default"];
        }
    }
}
